home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / util / rexx / rexxmode10.lha / rxnq / rxnq.c < prev   
C/C++ Source or Header  |  1993-03-20  |  1KB  |  53 lines

  1. ;/* 
  2. sc rxnq.c LINK NOSTARTUP NOSTKCHK STRINGMERGE STREQ IGNORE=73
  3. quit
  4. */
  5. /*
  6.  *  NAME
  7.  *    rxnq.c
  8.  *
  9.  *  DESCRIPTION
  10.  *    This is a small HACK which removes the quotes from a commandline
  11.  *    and executes RX. This is due to a bug in GNUEmacs Amiga port 1.26
  12.  *    which quotes the arguments to commands executed with
  13.  *    (start-process ...)
  14.  *
  15.  *    To compile under SAS/C 6.x, execute this file.
  16.  *
  17.  *  STATUS
  18.  *    This file is distributed under the GNU General Publc License.
  19.  *
  20.  *  AUTHOR
  21.  *    Anders Lindgren, d91ali@csd.uu.se
  22.  */
  23.  
  24. #include <proto/exec.h>
  25. #include <proto/dos.h>
  26.  
  27. #include <string.h>
  28.  
  29. __asm __saveds int
  30. not_main(register __a0 const char * arg, register __d0 int len)
  31. {
  32.     register struct Library * DOSBase;
  33.     register UBYTE * str;
  34.     register int rc = 20;
  35.  
  36.     if (DOSBase = OpenLibrary("dos.library", 0)) {
  37.     if (str = AllocMem(len+4, 0)) {
  38.         strcpy(str, "RX ");
  39.         if (len >= 3 && arg[0] == '\"' && arg[len-2] == '\"') {
  40.         strncat(str, arg+1, len-3);
  41.         }
  42.         else {
  43.         strncat(str, arg, len-1);
  44.         }
  45.         rc = (Execute(str, NULL, Output()) ? 0 : 10);
  46.         
  47.         FreeMem(str, len+4);
  48.     }
  49.     CloseLibrary(DOSBase);
  50.     }
  51.     return(rc);
  52. }
  53.